package actions;



import game.constants.ReferenceAction;
import interfaces.ActionInterface;
import interfaces.impl.Action;
import objects.SpetialFeature;
import universe.Universe;

public class ActionModifySpetialFeature extends Action{
	
	
	private double value;
	private int featureId;
	

	@Override
	public boolean processActionChild(Universe world) {
		
		for(SpetialFeature fe : target.getListFeatures()){
			if(fe.getId()==featureId){
	
				fe.setValue(value);
				//System.out.println("Modifique "+value);
				return true;
			}
		}
		
		return false;
	}

	public double getValue() {
		return value;
	}
	public void setValue(double value) {
		this.value = value;
	}
	public int getFeatureId() {
		return featureId;
	}
	public void setFeatureId(int featureId) {
		this.featureId = featureId;
	}
	
	@Override
	public void initializeName() {
		name="Modify Special Feature";
		
	}

	@Override
	public void initializeId() {
		this.id=ReferenceAction.ACTION_MODIFY_SPETIAL_FEATURE;
		
	}

	@Override
	public void modifyChild(ActionInterface action) {
		if (action instanceof ActionModifySpetialFeature) {
			ActionModifySpetialFeature ac = (ActionModifySpetialFeature) action;
			
			this.name=ac.name;
			this.value=ac.value;
			this.featureId=ac.featureId;
			
		}
		
	}

	
	@Override
	public ActionModifySpetialFeature cloneAction(){
		ActionModifySpetialFeature action = new ActionModifySpetialFeature();
		action.modifyAction(this);
		return action;
		
	}

	

}
